// pages/peoplePage/peoplePage.js
var app = getApp();
var com = require('../../common.js');
Page({
  data: {
    statusd: 1
  },
  onLoad: function(options) {
    var _this = this
    if (wx.getStorageSync('token')) {} else {
      wx.reLaunch({
        url: '/pages/login/login',
      })
      return false;
    }
    _this.oncustomerList();
    setTimeout(() => {
      _this.setData({
        statusd: 0
      })
    }, 1500)
  },
  onReady: function() {},
  onShow: function() {
    if (typeof this.getTabBar === 'function' &&
      this.getTabBar()) {
      this.getTabBar().setData({
        selected: 2
      })
    }
  },
  onPageList(e) {
    wx.navigateTo({
      url: '/pages/vision-details/vision-details?id=' + e.currentTarget.id + '&name=' + e.currentTarget.dataset.name,
    })
  },
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  onShareAppMessage: function() {},
  oncustomerList: function() {
    var _this = this
    com.link(app.link.customerList + wx.getStorageSync('store') + '.st', {}, function(res) {
      console.log(res);
      _this.setData({
        info: res.data.data
      })
    }, 'GET')
  }
})